/*
 * @Description: 字典
 * @Author: huacong
 * @Date: 2020-04-17 15:20:10
 * @LastEditTime: 2020-09-22 10:10:21
 * @LastEditors: huacong
 */
import { axios } from '@/utils/http/request'
import api from './api'
import { makeFormData } from '@/utils/util'

// 获取医保类型
export function getHealthEnsureType () {
  return axios({
    url: 'medical/sysBusiness/getSysBusiness.jspx',
    method: 'get'
  })
}

// 获取业务类型
export function getbusiList () {
  return axios({
    url: 'medical/business/busiList.jspx',
    method: 'post'
  })
}

// 单位目录树
export function getOrgAndDeviceTree () {
  return axios({
    url: api.orgAndDeviceTree,
    method: 'get'
  })
}

// 单位目录树
export function getOrgAllTree () {
  return axios({
    url: api.orgAllTree,
    method: 'get'
  })
}

// 机构目录树
export function getOrgTree () {
  return axios({
    url: api.orgTree,
    method: 'get'
  })
}

// 根据code获取视频地址
export function getVideoByCode (params) {
  return axios({
    url: 'medical/ossVideo/queryVideoReplay.jspx',
    method: 'post',
    params
  })
}

// 转换视频格式
export function videoFormat (rtspUrl) {
  const data = {
    rtspUrl,
    appName: 'hls_playback'
  }
  const formData = new FormData()
  makeFormData(data, formData)
  return axios({
    url: 'medical/ossVideo/rtspToM3u8.jspx',
    method: 'post',
    data: formData
  })
}

// 视频处理
export function activeJob (key) {
  return axios({
    url: 'medical/ossVideo/activeJob.jspx',
    method: 'POST',
    params: { key }
  })
}

// 视频详情
export function getCommonVideoInfo (videoId) {
  return axios({
    url: 'medical/ossVideo/videoInfo.jspx',
    method: 'POST',
    params: { videoId }
  })
}

// 科室
export function getDepartments () {
  return axios({
    url: 'medical/deparrelation/getDepartmentListByUser.jspx',
    method: 'POST'
  })
}

// 医院科室
export function getDepartmentsByHospital () {
  return axios({
    url: 'medical/medical/hospitalByLoginUser.jspx',
    method: 'POST'
  })
}

// 获取图片
export function getSignUrl (params) {
  return axios({
    url: '/medical/report/getUel.jspx',
    method: 'GET',
    params
  })
}

// 字典库
export function getDistList (params) {
  return axios({
    url: 'medical/sysDict/dictList.jspx',
    method: 'get',
    params
  })
}

// 获取统筹区
export function getZones () {
  return axios({
    url: '/medical/smplTask/zoneCodeList.jspx',
    method: 'get'
  })
}

// 下载视频
export function downloadVideo (path) {
  return axios({
    url: api.downVideo,
    method: 'get',
    params: { path },
    responseType: 'blob'
  })
}
